import request from '@/utils/request'

// 网关前缀 + 控制器前缀：/patient(网关) + /patientEvaluation(控制器)
const prefix = '/patient/patientEvaluation'

/**
 * 根据医生ID查询患者评价列表
 * 后端：GET {gateway}{prefix}/list/{doctorId}
 */
export function getPatientEvaluations(doctorId) {
  return request({
    url: `${prefix}/list/${doctorId}`,
    method: 'get'
  })
}

/**
 * 提交患者评价
 * 后端：POST {gateway}{prefix}/submit
 * @param {*} data { doctorId, score, content, images? }
 */
export function submitEvaluation(data) {
  return request({
    url: `${prefix}/submit`,
    method: 'post',
    data
  })
}

/**
 * 校验是否允许评价（如是否已评价、是否满足条件等）
 * 后端：GET {gateway}{prefix}/checkAllowed?doctorId=xxx
 */
export function checkEvaluationAllowed(doctorId) {
  return request({
    url: `${prefix}/checkAllowed`,
    method: 'get',
    params: { doctorId }
  })
}
